/// Creator:      fengliang
/// CreatDate:    2022-06-14
/// Description:  节点配置 
Class CF.NUR.MNISV3.BloodNode Extends %Persistent
{

/// 节点名称
Property NodeName As %String(TRUNCATE = 1) [ SqlColumnNumber = 2 ];

/// 节点code
Property NodeCode As %String(TRUNCATE = 1) [ SqlColumnNumber = 3 ];

/// 模板类型 Blood 输血 Exe  执行  Tour 巡视等 
Property NodeType As %String(TRUNCATE = 1) [ SqlColumnNumber = 4 ];

/// 节点序号
Property NodeSort As %String(TRUNCATE = 1) [ SqlColumnNumber = 5 ];

/// 院区ID
Property HospId As %String(TRUNCATE = 1) [ SqlColumnNumber = 6 ];

/// 是否有效
Property ValidFlag As %String(TRUNCATE = 1) [ SqlColumnNumber = 7 ];

/// 必要条件 输血:F/First/第一个血袋 L/Last/最后一个血袋 R/Required/每一个血袋 空/非必须
Property RequiredFlag As %String(TRUNCATE = 1) [ SqlColumnNumber = 8 ];

/// 【必填】可操作节点（ 多个用!分隔）-->对应当前NodeCode
Property NodeSub As %String(TRUNCATE = 1) [ SqlColumnNumber = 9 ];

/// 闭环显示
Property ShowFlag As %String(TRUNCATE = 1) [ SqlColumnNumber = 10 ];

/// 【必填】关联模板（ 多个用!分隔）-->对应模块 CF.NUR.MNISV3.ModelForm
Property ModelCode As %String(TRUNCATE = 1) [ SqlColumnNumber = 11 ];

/// 显示模板
Property ShowModelCode As %String(TRUNCATE = 1) [ SqlColumnNumber = 12 ];

/// 是否校验患者
Property PatFlag As %String(TRUNCATE = 1) [ SqlColumnNumber = 13 ];

/// 签名标记(loginDouble 双签 loginSingle/空 单签  double 双签  single 单签) LD LS D S
Property SignFlag As %String(TRUNCATE = 1) [ SqlColumnNumber = 14 ];

/// 唯一标记(Y 不可重复  空/N 可重复)
Property OneFlag As %String(TRUNCATE = 1) [ SqlColumnNumber = 15 ];

/// 索引  院区ID  +  模板类型 Blood 输血 Exe  执行  Tour 巡视等 
Index Code On (HospId, NodeType, NodeCode);

Index Type On (HospId, NodeType, NodeSort);

/// Creator:      fengliang
/// CreatDate:    2022-06-14
/// Description:  保存 
/// Method        w ##class(CF.NUR.MNISV3.BloodNode).Save("","NodeName|默认^NodeCode|D^NodeType|BLOOD^NodeSort|0^HospId|2^ValidFlag|Y^RequiredFlag|")
/// Method        w ##class(CF.NUR.MNISV3.BloodNode).Save("","NodeName|取血^NodeCode|G^NodeType|BLOOD^NodeSort|1^HospId|2^ValidFlag|Y^RequiredFlag|R")
/// Method        w ##class(CF.NUR.MNISV3.BloodNode).Save("","NodeName|接收^NodeCode|R^NodeType|BLOOD^NodeSort|2^HospId|2^ValidFlag|Y^RequiredFlag|R")
/// Method        w ##class(CF.NUR.MNISV3.BloodNode).Save("","NodeName|输血前巡视^NodeCode|BT^NodeType|BLOOD^NodeSort|3^HospId|2^ValidFlag|Y^RequiredFlag|F")
/// Method        w ##class(CF.NUR.MNISV3.BloodNode).Save("","NodeName|开始^NodeCode|S^NodeType|BLOOD^NodeSort|4^HospId|2^ValidFlag|Y^RequiredFlag|R")
/// Method        w ##class(CF.NUR.MNISV3.BloodNode).Save("","NodeName|巡视^NodeCode|T^NodeType|BLOOD^NodeSort|5^HospId|2^ValidFlag|Y^RequiredFlag|R")
/// Method        w ##class(CF.NUR.MNISV3.BloodNode).Save("","NodeName|暂停^NodeCode|SU^NodeType|BLOOD^NodeSort|6^HospId|2^ValidFlag|Y^RequiredFlag|R")
/// Method        w ##class(CF.NUR.MNISV3.BloodNode).Save("","NodeName|继续^NodeCode|C^NodeType|BLOOD^NodeSort|7^HospId|2^ValidFlag|Y^RequiredFlag|R")
/// Method        w ##class(CF.NUR.MNISV3.BloodNode).Save("","NodeName|结束^NodeCode|E^NodeType|BLOOD^NodeSort|8^HospId|2^ValidFlag|Y^RequiredFlag|R")
/// Method        w ##class(CF.NUR.MNISV3.BloodNode).Save("","NodeName|输血后巡视^NodeCode|AT^NodeType|BLOOD^NodeSort|9^HospId|2^ValidFlag|Y^RequiredFlag|L")
/// Method        w ##class(CF.NUR.MNISV3.BloodNode).Save("","NodeName|回收^NodeCode|RE^NodeType|BLOOD^NodeSort|10^HospId|2^ValidFlag|Y^RequiredFlag|R")
/// Method        w ##class(CF.NUR.MNISV3.BloodNode).Save("","NodeName|交接^NodeCode|RECEIVE^NodeType|INFORD^NodeSort|1^HospId|2^ValidFlag|Y^RequiredFlag|R")
/// Method        w ##class(CF.NUR.MNISV3.BloodNode).Save("","NodeName|摆药^NodeCode|PUTORD^NodeType|INFORD^NodeSort|2^HospId|2^ValidFlag|Y^RequiredFlag|R")
/// Method        w ##class(CF.NUR.MNISV3.BloodNode).Save("","NodeName|核对^NodeCode|AUDITDES^NodeType|INFORD^NodeSort|3^HospId|2^ValidFlag|Y^RequiredFlag|R")
/// Method        w ##class(CF.NUR.MNISV3.BloodNode).Save("","NodeName|配液^NodeCode|DESPENSING^NodeType|INFORD^NodeSort|4^HospId|2^ValidFlag|Y^RequiredFlag|R")
/// Method        w ##class(CF.NUR.MNISV3.BloodNode).Save("","NodeName|输注^NodeCode|PUNCTURE^NodeType|INFORD^NodeSort|5^HospId|2^ValidFlag|Y^RequiredFlag|R")
/// Method        w ##class(CF.NUR.MNISV3.BloodNode).Save("","NodeName|巡视^NodeCode|TOUR^NodeType|INFORD^NodeSort|6^HospId|2^ValidFlag|Y^RequiredFlag|R")
/// Method        w ##class(CF.NUR.MNISV3.BloodNode).Save("","NodeName|暂停^NodeCode|SUSPEND^NodeType|INFORD^NodeSort|7^HospId|2^ValidFlag|Y^RequiredFlag|R")
/// Method        w ##class(CF.NUR.MNISV3.BloodNode).Save("","NodeName|继续^NodeCode|CONTINUE^NodeType|INFORD^NodeSort|8^HospId|2^ValidFlag|Y^RequiredFlag|R")
/// Method        w ##class(CF.NUR.MNISV3.BloodNode).Save("","NodeName|停止^NodeCode|STOP^NodeType|INFORD^NodeSort|9^HospId|2^ValidFlag|Y^RequiredFlag|R")
/// Method        w ##class(CF.NUR.MNISV3.BloodNode).Save("","NodeName|结束^NodeCode|FINISH^NodeType|INFORD^NodeSort|10^HospId|2^ValidFlag|Y^RequiredFlag|R")
///               w ##class(CF.NUR.MNISV3.BloodNode).Save("","NodeName|默认^NodeCode|DINFORD^NodeType|INFORD^NodeSort|0^HospId|2^ValidFlag|Y^RequiredFlag|")
ClassMethod Save(id, parr)
{
    s tmp=""
    s a=##class(web.DHCMGNurComm).setmoudtmp(parr,.tmp)
    s rw=$O(^CF.NUR.MNISV3.BloodNodeI("Code"," "_tmp("HospId")," "_tmp("NodeCode")))
    q:rw=""&&(id'="") "err:请勿录入重复的模板!"
    if id'=""
    {
        s rec=##class(CF.NUR.MNISV3.BloodNode).%OpenId(id)
    }else{
        s rec=##class(CF.NUR.MNISV3.BloodNode).%New()
    }
    i $d(tmp("NodeCode")) s rec.NodeCode=tmp("NodeCode")
    i $d(tmp("NodeName")) s rec.NodeName=tmp("NodeName")
    i $d(tmp("NodeType")) s rec.NodeType=tmp("NodeType")
    i $d(tmp("NodeSort")) s rec.NodeSort=tmp("NodeSort")
    i $d(tmp("HospId")) s rec.HospId=tmp("HospId")
    i $d(tmp("ValidFlag")) s rec.ValidFlag=tmp("ValidFlag")
    i $d(tmp("RequiredFlag")) s rec.RequiredFlag=tmp("RequiredFlag")
    i $d(tmp("NodeSub")) s rec.NodeSub=tmp("NodeSub")
    i $d(tmp("ShowFlag")) s rec.ShowFlag=tmp("ShowFlag")
    i $d(tmp("ModelCode")) s rec.ModelCode=tmp("ModelCode")
    e  s rec.ModelCode="PATINFO!BLOODINFO" //默认配置信息
    i $d(tmp("PatFlag")) s rec.PatFlag=tmp("PatFlag") // 是否校验患者
    i $d(tmp("SignFlag")) s rec.SignFlag=tmp("SignFlag") // 签名标记(double 双签  single/空 单签)
    s sc=rec.%Save()
    s id=rec.%Id()
    d rec.%Close()
    q:$$$ISERR(sc) "err:"_$SYSTEM.Status.GetErrorText(sc)
    q id
}

Storage Default
{
<Data name="BloodNodeDefaultData">
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>NodeName</Value>
</Value>
<Value name="3">
<Value>NodeCode</Value>
</Value>
<Value name="4">
<Value>NodeType</Value>
</Value>
<Value name="5">
<Value>NodeSort</Value>
</Value>
<Value name="6">
<Value>HospId</Value>
</Value>
<Value name="7">
<Value>ValidFlag</Value>
</Value>
<Value name="8">
<Value>RequiredFlag</Value>
</Value>
<Value name="9">
<Value>NodeSub</Value>
</Value>
<Value name="10">
<Value>ShowFlag</Value>
</Value>
<Value name="11">
<Value>ModelCode</Value>
</Value>
<Value name="12">
<Value>ShowModelCode</Value>
</Value>
<Value name="13">
<Value>PatFlag</Value>
</Value>
<Value name="14">
<Value>SignFlag</Value>
</Value>
<Value name="15">
<Value>OneFlag</Value>
</Value>
</Data>
<DataLocation>^CF.NUR.MNISV3.BloodNodeD</DataLocation>
<DefaultData>BloodNodeDefaultData</DefaultData>
<ExtentSize>11</ExtentSize>
<IdLocation>^CF.NUR.MNISV3.BloodNodeD</IdLocation>
<IndexLocation>^CF.NUR.MNISV3.BloodNodeI</IndexLocation>
<Property name="%%CLASSNAME">
<AverageFieldSize>2</AverageFieldSize>
<Selectivity>100.0000%</Selectivity>
</Property>
<Property name="%%ID">
<AverageFieldSize>3</AverageFieldSize>
<Selectivity>1</Selectivity>
</Property>
<Property name="HospId">
<AverageFieldSize>3</AverageFieldSize>
<Selectivity>100.0000%</Selectivity>
</Property>
<Property name="ModelCode">
<AverageFieldSize>5.09</AverageFieldSize>
<Selectivity>50.0000%</Selectivity>
</Property>
<Property name="NodeCode">
<AverageFieldSize>3.36</AverageFieldSize>
<Selectivity>9.0909%</Selectivity>
</Property>
<Property name="NodeName">
<AverageFieldSize>7.09</AverageFieldSize>
<Selectivity>9.0909%</Selectivity>
</Property>
<Property name="NodeSort">
<AverageFieldSize>3.09</AverageFieldSize>
<Selectivity>9.0909%</Selectivity>
</Property>
<Property name="NodeSub">
<AverageFieldSize>5.36</AverageFieldSize>
<Selectivity>10.0000%</Selectivity>
</Property>
<Property name="NodeType">
<AverageFieldSize>7</AverageFieldSize>
<Selectivity>100.0000%</Selectivity>
</Property>
<Property name="OneFlag">
<AverageFieldSize>2</AverageFieldSize>
<Selectivity>100.0000%</Selectivity>
</Property>
<Property name="PatFlag">
<AverageFieldSize>2</AverageFieldSize>
<Selectivity>100.0000%</Selectivity>
</Property>
<Property name="RequiredFlag">
<AverageFieldSize>2.91</AverageFieldSize>
<OutlierSelectivity>.818182:"R"</OutlierSelectivity>
<Selectivity>9.0909%</Selectivity>
</Property>
<Property name="ShowFlag">
<AverageFieldSize>2</AverageFieldSize>
<Selectivity>100.0000%</Selectivity>
</Property>
<Property name="ShowModelCode">
<AverageFieldSize>2</AverageFieldSize>
<Selectivity>100.0000%</Selectivity>
</Property>
<Property name="SignFlag">
<AverageFieldSize>2</AverageFieldSize>
<Selectivity>100.0000%</Selectivity>
</Property>
<Property name="ValidFlag">
<AverageFieldSize>3</AverageFieldSize>
<Selectivity>100.0000%</Selectivity>
</Property>
<SQLMap name="Code">
<BlockCount>-4</BlockCount>
</SQLMap>
<SQLMap name="IDKEY">
<BlockCount>-4</BlockCount>
</SQLMap>
<SQLMap name="Type">
<BlockCount>-4</BlockCount>
</SQLMap>
<StreamLocation>^CF.NUR.MNISV3.BloodNodeS</StreamLocation>
<Type>%Storage.Persistent</Type>
}

}
